import React, { FC } from 'react';

import { Link } from '../link';

interface BreadcrumbProps {
    text: string;

    isCurrent?: boolean;

    href?: string;
    target?: '_blank';
}

const Breadcrumb: FC<BreadcrumbProps> = (props) => {
    const children = buildChild(props.text);

    return props.isCurrent ? (
        children
    ) : (
        <Link title={props.text} href={props.href}>
            {children}
        </Link>
    );
};

Breadcrumb.displayName = 'Breadcrumb';

function buildChild(text: string) {
    return <span>{text}</span>;
}

export { Breadcrumb, BreadcrumbProps };
